package com.angel.email.configuration.builders.impl.custom;

import java.util.Collection;
import java.util.Map;

import com.angel.common.keyValue.KeyValue;
import com.angel.common.keyValue.KeyValueResult;
import com.angel.common.keyValue.impl.KeyValueResultImpl;
import com.angel.email.account.AccountInformation;
import com.angel.email.configuration.builders.IncomingEmailConfigurationBuilder;
import com.angel.email.custom.CustomEmailPropertiesBuilder;

/**
 *
 * @author William
 *
 */
public class CustomIncomingEmailConfigurationBuilder extends IncomingEmailConfigurationBuilder {

	private KeyValueResult properties;
	
	public CustomIncomingEmailConfigurationBuilder(Map<String, String> properties, AccountInformation accountInformation){
		super(accountInformation);
		this.setProperties(new KeyValueResultImpl(properties));
	}
	
	public CustomIncomingEmailConfigurationBuilder(Collection<KeyValue> properties, AccountInformation accountInformation){
		super(accountInformation);
		this.setProperties(new KeyValueResultImpl());
		this.getProperties().addAll(properties);
	}
	
	public CustomIncomingEmailConfigurationBuilder(KeyValueResult properties, AccountInformation accountInformation){
		super(accountInformation);
		this.setProperties(properties);
	}
	
	public CustomIncomingEmailConfigurationBuilder(CustomEmailPropertiesBuilder emailPropertiesBuilder, AccountInformation accountInformation){
		super(accountInformation);
		this.setProperties(emailPropertiesBuilder.buildEmailProperties());
	}


	public KeyValueResult buildIncomingEmailConfiguration() {
		return this.getProperties();
	}

	/**
	 * @return the properties
	 */
	protected KeyValueResult getProperties() {
		return properties;
	}

	/**
	 * @param properties the properties to set
	 */
	protected void setProperties(KeyValueResult properties) {
		this.properties = properties;
	}
}
